    <?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
<form action="payment_list_time" method="post">
<select name="id_mg">
    <?php foreach ($query as $rows)
    {?>
    <option value="<?=$rows->id_mg?>"><?php echo $rows->id_mg?></option>
    <?php
    }
?>
    <input type="submit" value="Select">
    <?php if(isset($error_mg)) echo $error_mg;?>
</form>
</select>